package C;

import java.util.*;
import java.util.stream.Collectors;

public class C72 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        List<Integer> list = Arrays.stream(sc.nextLine().split(" "))
                .map(Integer::parseInt).sorted().collect(Collectors.toList());
        System.out.println(list);
        System.out.println(getResult(list));

    }
    public static int getResult(List<Integer> list) {
        Iterator<Integer> it = list.iterator();
        int count=0;
        while(it.hasNext()) {
            int x = it.next();
            it.remove();
            System.out.println(list);
            while(it.hasNext()) {
                int y = it.next();
                if (y%x==0){
                    it.remove();
                    System.out.println(list);
                }
            }
            it = list.iterator();
            count++;
        }
        return count;
    }

}
